home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
UTILITY
/
ENV_20.ARJ
/
ENVIRON.DOC
< prev
next >
Wrap
Text File
|
1992-07-30
|
24KB
|
591 lines
█████████ ███ ███ ███ ███ ███ ████████ ███████ ███ ███
███▒▒▒▒▒▒▒ ████ ███▒ ███▒ ███▒ ███▒ ███▒▒▒███ ███▒▒▒███ ████ ███▒
███▒ █████ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ ███▒ █████ ███▒
████████ ███▒█▒███▒ ███▒ ███▒ ███▒ ████████▒▒ ███▒ ███▒ ███▒█▒███▒
███▒▒▒▒▒▒ ███▒█████▒ ███ ███▒▒ ███▒ ███▒███▒▒ ███▒ ███▒ ███▒█████▒
███▒ ███▒ ████▒ ███▒███▒ ███▒ ███▒ ███ ███▒ ███▒ ███▒ ████▒
█████████ ███▒ ███▒ ▒███▒▒▒ ███▒ ███▒ ███ ███████▒▒ ███▒ ███▒
▒▒▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒ ▒▒▒▒▒▒▒ ▒▒▒ ▒▒▒
Version 2.0
July 30, 1992
Copyright 1992 by David E. Key
Arlington, Texas
CompuServe 76264,1532
TABLE OF CONTENTS
_____________________________________________________________________
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 1 - SYSTEM REQUIREMENTS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
HARDWARE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
A NOTE ON VIDEO. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
CHAPTER 2 - EXECUTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
USER SELECTED. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Delete with Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 6
User Specified Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
AUTOMATIC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Delete . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Delete with Configuration File . . . . . . . . . . . . . . . . . . . . . . . . . 8
User Specified Delete. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Restore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CHAPTER 3 - COMMAND LINE PARAMETERS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
DESCRIPTION. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
AVAILABLE COMBINATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
CHAPTER 4 - RELATED FILES. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
SAVED ENVIRONMENT FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CONFIGURATION FILE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
CHAPTER 5 - LIMITATIONS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
- 2 -
INTRODUCTION
_____________________________________________________________________
ENVIRON was written to solve the problem of network administrators adding an
onerous number of environment variables to user's PC's with their own harddisk
and battery of applications. In our shop, the menu system we use adds about 10
variables that take up approximately 200 bytes. In addition to managing the
woes created by your friendly network administrator, ENVIRON can also be used
to manage different scenarios where applications need there own subset of
environment variables either to run or to run more efficiently. The program is
designed for use in batch files once the user becomes comfortable with the
workings by using the "user selected" mode. Using a little creativity, you
should find it quite easy to accomplish just about anything that has to do with
these little critters.
If you find ENVIRON useful, a gift of any amount would be appreciated. There
is no warranty of any kind. The copyright owner does not warrant that the
software will meet your requirements or that it is error free, nor may the
copyright owner be help responsible for any loss of profits or data. Whether
you like the software or not, I would appreciate any comments related to
problems you're having or suggestions for improvement. Please address all
correspondence to:
David E. Key
5901 Kesler Drive
Arlington, TX 76017-1066
OVERVIEW
_____________________________________________________________________
ENVIRON is a utility that can be used to delete selected variables from the DOS
master environment, storing those selected to a file before it does so. It can
also be used to restore these saved variables, or a selected subset thereof to
the master environment. There are two modes of operation; "user selected" and
"automatic".
"User selected" presents a screen showing the variables, and offering the user
the opportunity to mark them for deletion or restoration. There are several
options within this mode that can be specified via command line parameters.
Discussion of these is deferred to the following chapters.
"Automatic" simply runs the program "silently" (i.e. no screens are presented
or messages are printed as long as execution completes successfully). If
execution is completed successfully a value of 0 is returned to DOS upon
termination. Otherwise a value of 1 is returned. This mode also provides for
several command line parameters.
- 3 -
CHAPTER 1 - SYSTEM REQUIREMENTS
_____________________________________________________________________
HARDWARE
--------------------------------------------------------------------------
The ENVIRON.EXE program requires about 91K of memory. It was developed and
tested exclusively under MS-DOS 5.00. How it will behave under another operat-
ing system, I have no idea. However, because of the method used to "grab" the
master environment, I feel fairly comfortable that it should not be a problem.
The code is written in C++ and should run on anything greater than or equal to
an 80x86. There are no floating point routines, so performance with a coproc-
essor is moot. Disk size is certainly no issue. The only additional file
space required by the program is exactly equal to the size in bytes of the
variables removed from the environment.
A NOTE ON VIDEO
--------------------------------------------------------------------------
ENVIRON writes directly to video memory in "user selected" mode and uses the
following steps to determine what that address should be. First, the mode is
tested and if it is not equal to 7 the address is set to B800h. If the mode is
7, the address used is B000h. If the mode is equal to 3, color is added,
otherwise text is presented in black and white. If you experience video
problems it can probably be traced to the above. "Automatic" mode uses no
video except upon error such as being unable to find the saved environment
file, or being unable to change directories.
- 4 -
CHAPTER 2 - EXECUTION
_____________________________________________________________________
USER SELECTED
--------------------------------------------------------------------------
Delete
------
In "user selected" delete mode a screen similar to the following example
is presented:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ DELETE MODE ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
╔═════════════════════════════════════════════════════════════════════════════╗
║ ENVIRON.EXE ║
║ Environment Manipulation Utility ║
║ Version 2.0 ║
╚═════════════════════════════════════════════════════════════════════════════╝
√ PROMPT=$P$G
√ TIGA=-MC:\TIGA -LC:\TIGA
√ CLIPPER=F65,R26,V022,E0,X64
√ RIMID=C6
√ COMSPEC=C:\COMMAND.COM
√ PATH=C:\;C:\DOS5;C:\PCTOOLS;C:\UTIL;C:\XTGOLD;C:\BORLANDC\BIN;C:\NORTON; ...
√ S_1=Home
√ S_2=of
√ S_3=the
√ S_4=free
√ S_5=and
┌──────────────────────────────────────────────────────┐
│ Use arrow keys () to highlight item █ F7 to mark │
│ / unmark █ F2 to write selected variables to file │
│ and remove from environment █ F10 to abort operation │
└──────────────────────────────────────────────────────┘
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ PGDN / PGUP for more ... ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
The top line of the screen provides information on the mode of operation.
In this case, "DELETE MODE". The available keys are listed in the out-
lined box near the bottom of the screen. Not shown here, but obvious in
the program, the currently selected item is highlighted in BLACK on
LIGHTGRAY. The arrow keys can be used to move up and down the list of
selections. Those items that are marked with a "√" character are "select-
ed". Selection can be toggled on and off by pressing the F7 key. In this
mode all items are selected by default when the program is started. If
there are more than 11 variables in the environment, a message is dis-
played on the bottom of the screen stating that PGDN or PGUP can be
pressed to view the next (or previous) screen of variables. If any one
variable is greater than 74 characters in length, it is displayed with 3
trailing dots (...). Not to worry, this is merely for cosmetics, the true
value is still "in there." However, you would probably think that a good
program would let you use the right and left arrow keys to view the rest
of it. Unfortunately, this isn't one of those kind of "good ones." Once
all selections have been made, F2 can be pressed to write out the selected
variables to the "save" file and to remove them from the environment. Of
course, there is an abort key ... pressing F10 at any time discards all
changes and returns you to DOS. No changes are made in this instance.
- 5 -
Delete with Configuration File
------------------------------
In "user selected" delete with configuration file mode the screen appears
exactly the same as that for "user selected" delete mode except that the
items specified in the configuration file are rendered unselectable.
Their status is noted on color displays in DARKGRAY on BLUE. On non-color
monitors their colors are LIGHTGRAY on BLACK. It is impossible to over-
ride their status because the arrow keys cannot be used to highlight them.
The top line of screen indicates "RESTRICTED DELETE MODE".
User Specified Delete
---------------------
This mode should not be confused with "user selected" delete mode. In
this mode, wildcard parameters are given that specify which variables
should be marked for deletion by default as opposed to which variables
should NOT be deleted, or selecting them all. Once again, the screen
appears exactly the same as that for "user selected" delete mode except
that the items matching the wildcard parameters are marked for deletion
with those not matching not being marked. All items are available for
marking/unmarking in this mode. The top line of screen indicates "DELETE
MODE".
The wildcard parameters follow the same form as those used by MS-DOS when
specifying file names to be acted upon by the operating system. The
exception to this is that the "?" character is not supported. If this
character is used, ENVIRON will search for it explicitly in the list of
environment variables. The "*" is supported in one instance only per
wildcard parameter and may occur anywhere in the string. Each wildcard
parameter MUST be separated by one space and should follow a SINGLE "/S:"
parameter. A space after the initial "/S:" specifier is optional. Some
examples:
The parameter "AS*" would find:
ASCII
ASKME
ASTER
it would NOT find:
FAST
RASTER
The parameter "*ED" would find:
ACTED
SUPPORTED
SEPARATED
it would NOT find:
MEDELY
BEDS
The parameter "FILE*BIG" would find:
FILE01BIG
FILE02BIG
- 6 -
it would not find:
FIL001BIG
FIL002BIG
Restore
-------
In "user selected" delete mode a screen similar to the following example
is presented:
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ RESTORE MODE ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
╔═════════════════════════════════════════════════════════════════════════════╗
║ ENVIRON.EXE ║
║ Environment Manipulation Utility ║
║ Version 2.0 ║
╚═════════════════════════════════════════════════════════════════════════════╝
√ NU=C:\NORTON
√ S_FILEDIR=Z:\STATION\C6\
√ S_FILE=49
√ S_LOGIN=DAVID
√ S_DRIVE=F:
√ OS=MSDOS
√ VER=V5.00
√ S_DOS=V5.00
√ S_MENU=RISKMAIN
√ S_PROJECT=RISK_MANAGEMENT
√ PRT_GROUP=RISK_PRT
┌──────────────────────────────────────────────────────┐
│ Use arrow keys () to highlight item █ F7 to │
│ mark / unmark █ F2 to insert selected variables │
│ into environment █ F10 to abort operation │
└──────────────────────────────────────────────────────┘
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ PGDN / PGUP for more ... ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
The screen appears exactly the same as that for "user selected" delete
mode except that the F2 key restores the saved environment variables to
the master environment. All other keys perform the same function as that
described above. It should be noted that if all variables from the file
are not restored, those excluded are lost forever. An ASCII file of the
same name and format could be created in the root directory to restore
these variables later if so desired.
AUTOMATIC
--------------------------------------------------------------------------
Delete
------
"Automatic" delete mode performs the same function as "user selected"
delete mode except that no operator intervention is required. Unless some
sort of unusual error occurs such as being unable to change to the root
directory, operation proceeds "silently" and a value of 0 is returned to
DOS upon completion. If an error occurs a value of 1 is returned to DOS.
As with "user selected" delete, the default is to delete all variables
from the environment. This is probably not the desired effect so "auto-
matic" delete with configuration file mode is provided to retain those
variables contained in the configuration file.
- 7 -
Delete with Configuration File
------------------------------
"Automatic" delete with configuration file mode operates the same as its
"user selected" cousin except that no operator intervention is required.
Unless some sort of unusual error occurs such as being unable to change to
the root directory, operation proceeds "silently" and a value of 0 is
returned to DOS upon completion. If an error occurs a value of 1 is
returned to DOS. As with the "user selected" mode, the default is to
delete all variables from the environment except those contained in the
configuration file.
User Specified Delete
---------------------
"Automatic" user specified delete mode operates the same as its "user
selected" cousin except that no operator intervention is required. Unless
some sort of unusual error occurs such as being unable to change to the
root directory, operation proceeds "silently" and a value of 0 is returned
to DOS upon completion. If an error occurs a value of 1 is returned to
DOS. As with the "user selected" mode, the default is to delete all
variables from the environment that match the wildcard parameters speci-
fied on the command line.
Restore
-------
"Automatic" restore mode performs the same function as "user selected"
restore mode except that no operator intervention is required. Unless
some sort of unusual error occurs such as being unable to change to the
root directory or being unable to find the saved environment file, opera-
tion proceeds "silently" and a value of 0 is returned to DOS upon comple-
tion. If an error occurs a value of 1 is returned to DOS. As with "user
selected" restore, the default is to restore all variables to the environ-
ment. If this is not the desired effect, the saved environment file could
be edited to include only those needed.
CHAPTER 3 - COMMAND LINE PARAMETERS
_____________________________________________________________________
DESCRIPTION
--------------------------------------------------------------------------
Usage: C:\>ENVIRON "userparameter(s)"
Available Parameters:
/H - Display online help screens.
/D - Delete variables from environment.
/C - Use configuration file to specify those variables that should be
excluded from deletion.
/S: - Delete all variables that match a specified pattern using the
familiar DOS "*" wildcard character. Multiple patterns can be
specified by separating them with one space.
/R - Restore saved variables to the environment.
/A - Automatic mode, no user intervention required.
AVAILABLE COMBINATIONS
--------------------------------------------------------------------------
/H - Display online HELP screens.
- 8 -
/D - User selected DELETE mode, default is delete all.
/D /C - User selected DELETE mode, default excludes those
contained in the configuration file.
/D /A - Automatic DELETE mode, default is delete all.
/D /C /A - Automatic DELETE mode, default excludes those
contained in the configuration file.
/S:<wildcard(s)> - User specified DELETE mode. Deletes only those
variables matching the pattern(s) specified as
wildcard(s).
/S:<wildcard(s)> /A - Automatic DELETE mode. Deletes only those vari-
ables matching the pattern(s) specified as wild-
card(s).
/R - User selected RESTORE mode, default is restore
all variables contained in the saved environment
file.
/R /A - Automatic RESTORE mode. Restores all variables
contained in the saved environment file.
The sequence of these parameters on the command line is insignificant.
However, for the "/S:" parameter all wildcard patterns must follow the
first and only "/S:" specified. Except in the case of the "/S:" parameter
anything following any of the other parameters without a space is ignored.
For example if the user accidentally typed "ENVIRON /D/A", ENVIRON would
be run in "user selected" delete mode, NOT "automatic" delete mode.
CHAPTER 4 - RELATED FILES
_____________________________________________________________________
SAVED ENVIRONMENT FILE
--------------------------------------------------------------------------
Upon executing ENVIRON in any of the delete modes a file entitled
SAVEDENV.TXT is written to the root directory of the disk on which
ENVIRON.EXE resides. This is a flat, ASCII file that writes each variable
and its associated value (separated by an "=" sign) to its own line in the
file. This file can be edited with a text editor, deleting or adding
lines as desired. Just be sure to follow the same format as that found in
the file created by ENVIRON itself. If the resulting file would contain
no variables after being created by ENVIRON, it is automatically deleted
prior to exiting.
CONFIGURATION FILE
--------------------------------------------------------------------------
A copy of an example configuration file should be included with this
distribution and is entitled ENVIRON.CFG. It must reside in the same
directory as ENVIRON.EXE. Basically, variables to exclude are listed on
individual lines WITHOUT the associated "=" sign or the variable's pur-
ported contents. Comments can be added by placing a semicolon anywhere on
the line.
CHAPTER 5 - LIMITATIONS
_____________________________________________________________________
There are several limitations in the program worth mentioning. First, the
number of environment variables that the program can handle is limited to 64.
- 9 -
In User Selected Delete Mode, the maximum number of wildcard combinations
following the "/S:" parameter is 15. And finally, environment variables
greater than 128 characters in length are not supported.
One "quirk" I have found, and still don't know the reason for, relates to
deleting the "COMSPEC" variable from the environment. The variable is not
visible after using the DOS "SET" command, and restores without problem. But,
shortly after that some or all of the environment variables disappear when
other applications are used. For this reason I would strongly suggest that you
NOT delete the "COMSPEC" variable.
- 10 -